import { Router } from 'express';
import prometheusController from '@controllers/prometheus.controller';

const router = Router();

/**
 * @route   GET /api/prometheus/query
 * @desc    执行 Prometheus 即时查询
 * @access  Private
 * @query   query, time (optional)
 */
router.get('/query', prometheusController.query.bind(prometheusController));

/**
 * @route   GET /api/prometheus/query_range
 * @desc    执行 Prometheus 范围查询
 * @access  Private
 * @query   query, start, end, step (optional)
 */
router.get('/query_range', prometheusController.queryRange.bind(prometheusController));

/**
 * @route   GET /api/prometheus/health
 * @desc    获取系统健康指标
 * @access  Private
 */
router.get('/health', prometheusController.getSystemHealth.bind(prometheusController));

/**
 * @route   GET /api/prometheus/metrics/application
 * @desc    获取应用性能指标
 * @access  Private
 */
router.get('/metrics/application', prometheusController.getApplicationMetrics.bind(prometheusController));

/**
 * @route   GET /api/prometheus/metrics
 * @desc    获取指标列表
 * @access  Private
 */
router.get('/metrics', prometheusController.getMetrics.bind(prometheusController));

/**
 * @route   GET /api/prometheus/timeseries
 * @desc    获取时间序列数据
 * @access  Private
 * @query   query, start, end, step
 */
router.get('/timeseries', prometheusController.getTimeSeriesData.bind(prometheusController));

/**
 * @route   GET /api/prometheus/labels
 * @desc    获取所有标签
 * @access  Private
 */
router.get('/labels', prometheusController.getLabels.bind(prometheusController));

/**
 * @route   GET /api/prometheus/labels/:label/values
 * @desc    获取标签值
 * @access  Private
 */
router.get('/labels/:label/values', prometheusController.getLabelValues.bind(prometheusController));

/**
 * @route   GET /api/prometheus/instances
 * @desc    获取实例列表
 * @access  Private
 */
router.get('/instances', prometheusController.getInstances.bind(prometheusController));

/**
 * @route   GET /api/prometheus/services
 * @desc    获取服务列表
 * @access  Private
 */
router.get('/services', prometheusController.getServices.bind(prometheusController));

/**
 * @route   GET /api/prometheus/status
 * @desc    检查 Prometheus 连接状态
 * @access  Private
 */
router.get('/status', prometheusController.checkHealth.bind(prometheusController));

/**
 * @route   GET /api/prometheus/rules
 * @desc    获取告警规则
 * @access  Private
 */
router.get('/rules', prometheusController.getAlertRules.bind(prometheusController));

export default router;
